package org.example.tvolatile;

import java.util.concurrent.TimeUnit;

public class myVolatile {
    private volatile  static  int i = 0;
    public static void main(String[] args) {

        new Thread(()-> {
            while(i == 0){

            }
        }).start();

        try {
            TimeUnit.SECONDS.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        i = 1;
        System.out.println(i);
    }
}
